import axios from 'axios';

const gethotsearchlist = (data) =>({
    type:'GET_HOT_SEARCH_LIST',
    data:data,
    totalPage:Math.ceil(data.length / 5),
});

export const searchInputFouce = () =>({
    type:'SEARCH_INPUT_FOUCE',
});

export const searchInputBlur = () =>({
    type:'SEARCH_INPUT_BIUR',
});

export const getlist = () => {
    return (dispatch) =>{
        axios.get('/api/hotsearch.json').then(function(res){
            const data = res.data.data;
            const action = gethotsearchlist(data)
            dispatch(action)
        }).catch(()=>{
        console.log('404  接口请求失败！！')
    })
    }
};

export const mouseEnt = () =>({
    type:'MOUSE_ENT',
});

export const mouseOut = () =>({
    type:'MOUSE_OUT',
});
export const changePage = () =>({
    type:'CHANGE_PAGE',
});
export const changeNextPage = () =>({
    type:'CHANGE_NEXT_PAGE',
});
export const getNextPage = (page) =>({
    type:'GET_NEXT_PAGE',
    page,
});
export const getfistPage = () =>({
    type:'GET_FIST_PAGE',
});
